<%@page import="com.hamizhong.iflowers.web.vo.VarietyVO"%>
<%@page import="com.hamizhong.iflowers.db.entity.Variety"%>
<%@page import="com.hamizhong.iflowers.web.vo.TestVO"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.7.2.js"></script>
<title>test title</title>
</head>
<%
	List<TestVO> testVOList = (List<TestVO>)request.getAttribute("testVOList");
	List<String[]> myTestTypeAttrList = (List<String[]>)request.getAttribute("myTestTypeAttrList");
	List<VarietyVO> myVarietyVOList = (List<VarietyVO>)request.getAttribute("myVarietyVOList");
%>

<body>
	<%
		for(int i=0;i<testVOList.size();i++) {
			out.println(testVOList.get(i).getTestName());
		}
	%>
	<br><br>
	<select>
	<%
		for(int i=0; i<myTestTypeAttrList.size(); i++) {
	%>
			<option value="<%=myTestTypeAttrList.get(i)[0]%>"><%=myTestTypeAttrList.get(i)[1] %></option>
	<%
		}
	%>
	</select>
	<br><br>
	测试数据库缓存：<br>
	<%
		for(int i=0;i<myVarietyVOList.size();i++) {
			out.println(myVarietyVOList.get(i).getVarietyName());
		}
	%>
	<br><br>
	<input type="button" name="testBtn" onclick="doAjaxTest()" style="cursor:pointer;" value="测试Ajax请求" >
	<br>

</body>

<script type="text/javascript">
	function doAjaxTest() {
		$.ajax({
			url: '<%=request.getContextPath()%>/ajaxTest.action',
			data: {},
			type: 'post',
			dataType: 'json',
			success: doAjaxTest_Callback
		});
	}
	function doAjaxTest_Callback(res) {
		var rs = res.result;
		if(rs == 0) {
			alert('成功！');
		}else {
			alert('失败:'+res.msg);
		}
	}
</script>

</html>